<template>
	<view class="container">
		<view class="myCollect">
			<view class="collect">
				<view class="inall">共 {{total}} 件商品</view>
				<view class="xian"></view>
				<view class="sptc" v-for="(item,index) in collectList" :key="index" @click="spmsg(item.productId)">
					<view class="spImage">
						<image :src="item.image" mode=""></image>
					</view>
					<view class="sptxt">
						<view class="taocan">
							<view class="tc1">{{item.storeName}}</view>
							<view class="num">x 1</view>
						</view>
						<view class="moren">默认</view>
						<view class="jiage">￥{{item.price}}</view>
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				// token
				token: wx.getStorageSync('shopToken'),
				total: "",
				collectList: ""
			}
		},
		onLoad() {
			this.collect();
		},
		methods: {
			collect() {
				const that = this;
				wx.request({
					header: {
						"Authori-zation": this.token
					},
					url: 'http://192.168.1.43:20090/api/front/collect/user',
					method: 'GET',
					success: function(res) {
						console.log(res.data.data.list, "this.res");
						console.log(res.data.data, "this.data");
						that.collectList = res.data.data.list
						that.total = res.data.data.list.length
					},
				});
			},

			spmsg(productId) {
				uni.navigateTo({
					url: "/pages/shop/detailsPage/index"
				})
			}
		}
	}
</script>

<style scoped lang="scss">
	.container {
		width: 100%;
		height: 100vh;
		background-color: #f5f5f5;
		display: flex;
		align-items: center;
		flex-direction: column;

		.myCollect {
			display: flex;
			justify-content: center;
			align-items: center;
			width: 674rpx;
			background-color: #ffffff;
			margin-top: 30rpx;
			border-radius: 20rpx;

			.collect {
				display: flex;
				flex-direction: column;
				justify-content: center;
				width: 610rpx;
			}

			.inall {
				font-weight: 400;
				font-size: 30rpx;
				color: #333333;
				margin-bottom: 20rpx;
				margin-top: 20rpx;
			}

			.xian {
				position: relative;
				width: 610rpx;
				height: 1rpx;
				background-color: #e9e9e9;
				margin-bottom: 30rpx;
			}

			.sptc {
				display: flex;
				flex-direction: row;
				align-items: center;
				justify-content: space-between;
				width: 610rpx;
				height: 129rpx;
				margin-bottom: 38rpx;

				.spImage {
					width: 129rpx;
					height: 129rpx;
					border-radius: 11rpx;

					image {
						width: 129rpx;
						height: 129rpx;
						border-radius: 11rpx;
					}
				}

				.sptxt {
					height: 120rpx;
					display: flex;
					flex-direction: column;
					justify-content: space-between;

					.taocan {
						width: 464rpx;
						display: flex;
						flex-direction: row;
						justify-content: space-between;

						.tc1 {
							width: 400rpx;
							font-weight: 400;
							font-size: 27rpx;
							color: #333333;
							white-space: nowrap;
							overflow: hidden;
							text-overflow: ellipsis;
						}


						.num {
							font-weight: 400;
							font-size: 24rpx;
							color: #868686;
						}
					}

					.moren {
						font-weight: 400;
						font-size: 20rpx;
						color: #868686;
					}

					.jiage {
						font-weight: 400;
						font-size: 24rpx;
						color: #D81A31;
					}
				}
			}
		}
	}
</style>